﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using Sumen.Business;
using Sumen.Business.Model;

namespace Sumen_Stock.LookAndFeel.Report.Sales
{
    public partial class rptConfirmSales : DevExpress.XtraReports.UI.XtraReport
    {
        public rptConfirmSales()
        {
            InitializeComponent();
            pCompanyAddress.Value = "Liên hê: " + ClsPublic.CompanyContactName + " - ĐT: " + ClsPublic.CompanyPhone + "- DĐ: " + ClsPublic.CompanyTelePhone;
            pCompanyName.Value = ClsPublic.CompanyName;
            pCompanyPhoneAndWeb.Value = "Email: " + ClsPublic.CompanyEmail + " - Website: " + ClsPublic.CompanyWeb;
        }

        public dsSales ConvertListToDataSet(List<orders_details> OrdersDetails)
        {
            dsSales ds = new dsSales();
            for (int i = 0; i < OrdersDetails.Count; i++)
            {
                DataRow row = ds.OrdersDetails.NewRow();
                row["Ords_PRODUCT_DETAILS_ID"] = OrdersDetails[i].Ords_PRODUCT_DETAILS_ID;
                row["Ords_Product_Name"] = OrdersDetails[i].Ords_Product_Name;
                row["Ords_IsOrders"] = OrdersDetails[i].Ords_IsOrders ?? 0;
                row["Ords_Quantity"] = OrdersDetails[i].Ords_Quantity ?? 0;
                row["Ords_UnitPrice"] = OrdersDetails[i].Ords_UnitPrice ?? 0;
                row["Ords_Surcharge"] = OrdersDetails[i].Ords_Surcharge ?? 0;
                row["Ords_Discount"] = OrdersDetails[i].Ords_Discount ?? 0;
                row["Ords_Amount"] = OrdersDetails[i].Ords_Amount ?? 0;
                ds.OrdersDetails.Rows.Add(row);
                
            }
            return ds;
        }





    }
}
